<?php
namespace app\admin\controller\system;

use app\admin\Controller;

class Config extends Controller
{
    use \app\admin\traits\controller\Controller;
    // 方法黑名单
    protected static $blacklist = [];

    protected static $isdelete = false;
    
    protected $group = ['不分组', '基本', '内容', '用户', '系统'];
    
    protected $ctype = ['数字', '字符', '文本', '数组', '枚举'];

    protected function filter(&$map)
    {
        if ($this->request->param("name")) {
            $map['name'] = ["like", "%" . $this->request->param("name") . "%"];
        }
        if ($this->request->param("title")) {
            $map['title'] = ["like", "%" . $this->request->param("title") . "%"];
        }
    }
    
    protected function formate_list(&$list)
    {
        foreach ($list as $vo) {
            $vo->group = isset($this->group[$vo->group]) ? $this->group[$vo->group] : '-';
            $vo->type = isset($this->ctype[$vo->type]) ? $this->ctype[$vo->type] : '-';
        }
    }
    
    protected function successAdd()
    {
        $this->clearCache();
    }
    
    protected function successEdit()
    {
        $this->clearCache();
    }
    
    protected function successForbid()
    {
        $this->clearCache();
    }
    
    protected function successResume()
    {
        $this->clearCache();
    }
    
    private function clearCache()
    {
        \Config::clearCache();
    }
}